package cn.tude.websocket.websocket.controller;


import cn.tude.websocket.base.config.response.JsonResult;
import cn.tude.websocket.websocket.pojo.vo.UserVO;
import cn.tude.websocket.websocket.service.MsgSerivice;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@Slf4j
@RestController
@RequestMapping("v1/msg/")
public class MsgController {

    @Autowired
    private MsgSerivice msgSerivice;



    @GetMapping("selectSayed")
    public JsonResult selectMsgShop(Long id){
        log.debug("查询曾经聊过天的人：用户id={}",id);
        List list = msgSerivice.getPersons(id);
        log.debug("返回的值为 list={}",list);
        return JsonResult.ok(list);
    }


    @GetMapping("getPerson")
    public JsonResult getUser(Long id){
        log.debug("查询人的信息：id={}",id);
        Object person = msgSerivice.getPerson(id);
        log.debug("返回值={}",person);
        return JsonResult.ok(person);
    }

}
